package edu.pku.sei.transformation.editor.controller.commands.link;

import edu.pku.sei.transformation.editor.model.CompositeTransformation;
import edu.pku.sei.transformation.editor.model.Transformation;
import edu.pku.sei.transformation.editor.model.TransformationComposition;

public class CompositionCreateCommand
		extends
		AbstractLinkCreateCommand<TransformationComposition, Transformation, CompositeTransformation> {
	public CompositionCreateCommand(TransformationComposition linkModel,
			Transformation sourceModel) {
		super("Create Composition", linkModel, sourceModel);
	}

	@Override
	public boolean canExecute() {
		return super.canExecute();
	}

	@Override
	public void execute() {
		target.getComposition().add(link);
		link.setComposite(source);

	}

	@Override
	public void undo() {
		target.getComposition().remove(link);
		link.setComposite(null);
	}

}
